package win.bigwhale.defense;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Point;

import javax.swing.JPanel;

public class Map extends JPanel {
	private Point[] monsterPath = {
			new Point(0, 1),
			new Point(1, 1),
			new Point(2, 1),
			new Point(2, 2),
			new Point(2, 3),
			new Point(3, 3),
			new Point(4, 3),
			new Point(5, 3),
			new Point(6, 3),
			new Point(7, 3),
			new Point(7, 4),
			new Point(7, 5),
			new Point(7, 6),
			new Point(7, 7),
			new Point(7, 8),
			new Point(8, 8),
			new Point(9, 8)
			};

	private Point[] towerPositions = {};
	
	public Map() {		
		this.setLayout(null);
		this.setSize(502, 502);
		Monster monster = new Monster(this);
		this.add(monster);
	}
	
	public Point[] getMonsterPath() {
		return monsterPath;
	}

	public Point[] getTowerPositions() {
		return towerPositions;
	}

	@Override
	protected void paintComponent(Graphics g) {
		super.paintComponent(g);
		g.setColor(Color.WHITE);
		g.fillRect(0, 0, 502, 502);
		paintMap(g);
	}

	private void paintMap(Graphics g) {
		g.setColor(Color.BLACK);
		for (int i = 0; i < 12; i++) {
			g.fillRect(i * 50, 0, 2, 500);
			g.fillRect(0, i * 50, 500, 2);
		}
		g.fillRect(500, 0, 2, 500);
		g.fillRect(0, 500, 500, 2);
	}
	
}
